/*
 * Copyright (c) 2006-2018, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2019-01-08     zylx         first version
 */

#ifndef __LCD_PORT_H__
#define __LCD_PORT_H__

#include "nuc970_lcd.h"

/* 4.3 inch screen, 480 * 272 */
#define LCD_WIDTH           ((uint16_t)480)
#define LCD_HEIGHT          ((uint16_t)272)
#define LCD_BITS_PER_PIXEL  16
#define LCD_BUF_SIZE        (LCD_WIDTH * LCD_HEIGHT * LCD_BITS_PER_PIXEL / 8)
#define LCD_PIXEL_FORMAT    RTGRAPHIC_PIXEL_FORMAT_RGB565

#define LCD_HSYNC_WIDTH     41
#define LCD_VSYNC_HEIGHT    10
#define LCD_HBP             2
#define LCD_VBP             2
#define LCD_HFP             2
#define LCD_VFP             2

#if defined (USE_E50A2V1)
extern VPOST_T DEF_E50A2V1;
#define DISPLAY_RGB888
#define VPOST_TYPE      DEF_E50A2V1
#define VASRC_TYPE      VA_SRC_RGB888
#elif defined (USE_E50A2V1_RGB565)
extern VPOST_T DEF_E50A2V1_RGB565;
#define DISPLAY_RGB565
#define VPOST_TYPE      DEF_E50A2V1_RGB565
#define VASRC_TYPE      VA_SRC_RGB565
#elif defined (USE_TM043)
extern VPOST_T TM043_RGB565;
extern VPOST_T CNKT043_RGB565;
#define DISPLAY_RGB565
#define VPOST_TYPE      TM043_RGB565
#define VASRC_TYPE      VA_SRC_RGB565
#endif

extern UINT8 *u8FrameBufPtr;

#define LCD_DISP_GPIO_NUM   GET_PIN(G, 14)
#define LCD_DE_GPIO_NUM   GET_PIN(G, 9)

void turn_off_lcd_backlight(void);
void turn_on_lcd_backlight(void);

#endif /* __LCD_PORT_H__ */
